//
//  APIManager+Login.m
//  NoneCar
//
//  Created by DongSen on 2018/7/13.
//  Copyright © 2018年 董森森. All rights reserved.
//

#import "APIManager+Login.h"

@implementation APIManager (Login)
- (NSURLSessionDataTask *)PostAccountLoginAccount:(NSDictionary*)parmars sucess:(void(^)(NSInteger code, NSDictionary* dict))sucess failure:(void(^)(NSInteger code, NSError *error))failure{
    
    return [self requestWithMethod:HttpRequestTypePost
                         URLString:AccountLoginURL
                        parameters:parmars
                              done:^(NSURLSessionDataTask *task, id responseObject) {
                                  sucess([self showResponseCode:task],responseObject);
                              } fail:^(NSURLSessionDataTask *task,NSError *error) {
                                  failure([self showResponseCode:task],error);
                              }];
}
- (NSURLSessionDataTask *)PostMobileLoginAccount:(NSDictionary*)parmars sucess:(void(^)(NSInteger code, NSDictionary* dict))sucess failure:(void(^)(NSInteger code, NSError *error))failure{
    return [self requestWithMethod:HttpRequestTypePost
                         URLString:PhoneLoginURL
                        parameters:parmars
                              done:^(NSURLSessionDataTask *task, id responseObject) {
                                  sucess([self showResponseCode:task],responseObject);
                              } fail:^(NSURLSessionDataTask *task,NSError *error) {
                                  failure([self showResponseCode:task],error);
                              }];
}
- (NSURLSessionDataTask *)PostSendCode:(NSDictionary*)parmars sucess:(void(^)(NSInteger code, NSDictionary* dict))sucess failure:(void(^)(NSInteger code, NSError *error))failure{
    return [self requestWithMethod:HttpRequestTypePost
                         URLString:SendVerifyCode
                        parameters:parmars
                              done:^(NSURLSessionDataTask *task, id responseObject) {
                                  sucess([self showResponseCode:task],responseObject);
                              } fail:^(NSURLSessionDataTask *task,NSError *error) {
                                  failure([self showResponseCode:task],error);
                              }];
}


- (NSURLSessionDataTask *)PostChangePassWord:(NSDictionary*)parmars sucess:(void(^)(NSInteger code, NSDictionary* dict))sucess failure:(void(^)(NSInteger code, NSError *error))failure{
    return [self requestWithMethod:HttpRequestTypePost
                         URLString:ChangePassWord
                        parameters:parmars
                              done:^(NSURLSessionDataTask *task, id responseObject) {
                                  sucess([self showResponseCode:task],responseObject);
                              } fail:^(NSURLSessionDataTask *task,NSError *error) {
                                  failure([self showResponseCode:task],error);
                              }];
}
- (NSURLSessionDataTask *)PostGetUserInfo:(NSDictionary*)parmars sucess:(void(^)(NSInteger code, NSDictionary* dict))sucess failure:(void(^)(NSInteger code, NSError *error))failure{
    return [self requestWithMethod:HttpRequestTypePost
                         URLString:APPMyInfo
                        parameters:parmars
                              done:^(NSURLSessionDataTask *task, id responseObject) {
                                  sucess([self showResponseCode:task],responseObject);
                              } fail:^(NSURLSessionDataTask *task,NSError *error) {
                                  failure([self showResponseCode:task],error);
                              }];
}

- (NSURLSessionDataTask *)PostLoginOut:(NSDictionary*)parmars sucess:(void(^)(NSInteger code, NSDictionary* dict))sucess failure:(void(^)(NSInteger code, NSError *error))failure{
    return [self requestWithMethod:HttpRequestTypePost
                         URLString:LoginOutURl
                        parameters:parmars
                              done:^(NSURLSessionDataTask *task, id responseObject) {
                                  sucess([self showResponseCode:task],responseObject);
                              } fail:^(NSURLSessionDataTask *task,NSError *error) {
                                  failure([self showResponseCode:task],error);
                              }];
}



@end
